from server import db
from sqlalchemy import Column, String, DateTime, func
from sqlalchemy.dialects.mysql import BIGINT
from server.model import BaseOrm


# 系统登录记录
class SysLoginRecord(BaseOrm):
    __tablename__ = 'sys_login_record'
    user_id = Column(BIGINT(20), nullable=False, server_default='0', comment="用户ID ")
    login_time = Column(DateTime, nullable=False, server_default=func.now(), comment="登录时间")
    username = Column(String(64), nullable=False, server_default='', comment="用户名 ")
    name = Column(String(64), nullable=False, server_default='', comment="姓名(昵称) ")
    ip = Column(String(16), nullable=False, server_default='', comment="最近登录IP ")
    gate = Column(String(16), nullable=False, server_default='', comment="出入口")


db.create_all()
